(1) Field of the Invention
The present invention relates to techniques for collecting resources which become unnecessary as a result of completion of an application, in an application execution apparatus.
(2) Related Art
In general application execution apparatuses, the kernel of the operating system collects resources (devices such as memory and keyboard) which become unnecessary as a result that, for example, an application is completed. In this Specification, “collection” means that the operating system side, such as the kernel, regains a resource which has been provided to an application, from the application. To collect resources, the kernel stores a collection procedure for each device. When a device used by some application becomes unnecessary, the kernel collects that device in accordance with a collection procedure for the device. In this way, resources can be efficiently utilized.
Also, in Java application execution apparatuses, for instance in personal computers, as for collection of resources other than memory, the Java middleware (so-called “virtual machine”) itself does-not collect the resources, but when the Java middleware ends, the kernel collects' the resources.
On the other hand, the collection of memory is performed by the Java middleware through garbage collection. The garbage collection is to collect unnecessary areas in memory. In Java, an application is loaded by loading each instance (“object”) of a plurality of classes that make up the application, into memory. Memory areas are shared by the objects loaded for the application, and are allocated to the objects in the order of loading. Therefore, if objects of a plurality of applications are sequentially loaded into memory, noncontiguous memory areas will end up being allocated to objects which belong to the same application. When memory areas are occupied by objects in such a noncontiguous manner, garbage collection is performed to resolve insufficient memory.
However, the aforementioned resource collection techniques have the following problems.
First, in the resource collection by the kernel is an application execution apparatus, each time a new device is added to the application execution apparatus, a collection procedure for the new device has to be stored in the kernel.
Secondly, in the resource collection in a Java application execution apparatus, if two or more applications are sequentially executed while the Java middleware is running, the kernel does not collect resources other than memory until the Java middleware ends. In other words, even when one application ends, resources other than memory which have been provided to that application are not collected. This being so, if the next application requires the same resources, the next application cannot be executed.
Thirdly, when memory areas noncontiguously allocated to objects become unnecessary, the burden of garbage-collecting such memory areas is significant.